import { ajax } from "./util.js"
//登录页面
let btn = document.querySelector("button")
let userInt = document.getElementsByName("username")
let pwdInt = document.getElementsByName("pwd")
let p = document.querySelector("p")
btn.onclick = () => {
    ajax.post("/login", { username: userInt[0].value, pwd: pwdInt[0].value }, (data) => {
        if (data.code === 200) {
            //登录成功
            window.location.href = "/";
        } else {
            //重新登录
            p.innerHTML = data.msg
            // console.log(data.msg)
        }
        console.log(data)
    })
}